﻿<Window x:Class="EmployeeTracker.View.MainView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:v="clr-namespace:EmployeeTracker.View"
        xmlns:vm="clr-namespace:EmployeeTracker.ViewModel"
        xmlns:local="clr-namespace:EmployeeTracker"
        Title="Employee Tracker" 
        WindowState="Maximized"
        Background="#FFEDEDED">
    
    <Window.Resources>
        <DataTemplate DataType="{x:Type vm:EmployeeWorkspaceViewModel}">
            <v:EmployeeWorkspaceView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:DepartmentWorkspaceViewModel}">
            <v:DepartmentWorkspaceView />
        </DataTemplate>
        
        <!--Local template used for loyalty board-->
        <DataTemplate x:Key="LoyaltyBoardItem">
            <DataTemplate.Resources>
                <ResourceDictionary Source="..\CompactFormStyles.xaml" />
            </DataTemplate.Resources>
            <Border Style="{StaticResource DetailBorder}" Margin="2,2,2,0">
                <StackPanel>
                    <TextBlock Text="{Binding Path=DisplayName}" FontWeight="Bold" />
                    <TextBlock Text="{Binding Path=Position}" FontStyle="Italic" />
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Hired " />
                        <TextBlock Text="{Binding Path=DisplayHireDate}" />
                    </StackPanel>
                </StackPanel>
            </Border>
        </DataTemplate>
    </Window.Resources>
    
    <Grid>

        <local:Banner VerticalAlignment="Top" />
        <Button Width="60" Height="40" VerticalAlignment="Top" Margin="5" HorizontalAlignment="Left" Style="{StaticResource GlossyButton}" Command="{Binding Path=SaveCommand}">Save</Button>

        <TabControl Padding="0" Margin="200,80,30,30" >
            <TabItem>
                <TabItem.Header>
                    Employees
                </TabItem.Header>
                <ContentControl Margin="10" Content="{Binding Path=.EmployeeWorkspace}" />
            </TabItem>
            <TabItem>
                <TabItem.Header>
                    Departments
                </TabItem.Header>
                <ContentControl Margin="10" Content="{Binding Path=.DepartmentWorkspace}" />
            </TabItem>
        </TabControl>
        
        <HeaderedContentControl Style="{StaticResource DisplayArea}" Margin="30,80,30,30" HorizontalAlignment="Left" Width="140" Height="Auto" VerticalAlignment="Top">
            <HeaderedContentControl.Header>
                Loyalty Board
            </HeaderedContentControl.Header>
            <ItemsControl ItemsSource="{Binding Path=LongServingEmployees, Mode=OneTime}" ItemTemplate="{StaticResource LoyaltyBoardItem}" />
        </HeaderedContentControl>
    </Grid>
</Window>
